<?php


for($col = 0; $col<$numDaysInWeek; $col += 1){
//	echo $calendarIndexer;
	if($calendarIndexer+$col == 7 || $calendarIndexer+$col == 0){
                $today = "class='today'";
        }
	echo "<td id='element' ".$today.">";
	$whileBool=0;
	$midBool = 0;
	while($whileBool==0){ 
		if (strcmp(substr($colSTime[$col][$colIterators[$col]],0,strlen($time)),$time)==0){
			if($midBool == 1){
				echo "<br/>";
			}
			$stTime = substr($colSTime[$col][$colIterators[$col]],0,5);
			$stTimePre = (int)substr($stTime,0,2);
			if($stTimePre >12){ 
				$stTimePre=$stTimePre-12; 
			}
			$stTimePost = substr($stTime,2,3);
			$enTime = substr($colETime[$col][$colIterators[$col]],0,5);
			$enTimePre = (int)substr($enTime,0,2);
			if($enTimePre > 12){
				$enTimePre = $enTimePre-12;
			}
			$enTimePost = substr($enTime,2,3);
			echo "<a href='midweekpage.php?midweek_name=";
			echo $colName[$col][$colIterators[$col]];
			echo "&error=0'>".$colSName[$col][$colIterators[$col]]."</a>";
			echo "<br/>(".$stTimePre.$stTimePost."-".$enTimePre.$enTimePost.")";
			$colIterators[$col] += 1;
			$midBool=1;
		} else {
			$whileBool=1;
			$midBool = 0;
			echo "&nbsp;";
		}
	}
	echo "</td>";
	$today = "";
}
?>
